<template>
  <div class="class-result">
    <h2>班级统计</h2>
    <ResultChart v-if="chartData" :data="chartData" />
  </div>
</template>

<script>
import ResultChart from '@/components/ResultChart.vue';
import { getClassStats } from '@/api/mbti';

export default {
  name: 'ClassResult',
  components: { ResultChart },
  data() {
    return {
      chartData: null
    };
  },
  async mounted() {
    const res = await getClassStats();
    this.chartData = res.data;
  }
};
</script>

<style scoped>
.class-result {
  max-width: 900px;
  margin: 30px auto;
}
</style>
